﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="S_CustomeAdd.aspx.cs" Inherits="JTicket.UI.S_CustomeAdd" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function AddCustomer() {
            if ($("#name").val() == "") { alert("请输入客户姓名！"); return false; }
            if ($("#tel").val() == "") { alert("请输入客户手机号码！"); return false; }
            if (confirm("是否提交客户关系资料！")) {
                $("#BtnSelete").attr("disabled", "disabled");
                var url = "AddCustomInfo.axd?Name=" + $("#name").val()
    + "&work=" + $("#ctl00_ContentPlaceHolder1_work").find("option:selected").text()
+ "&sex=" + $("input[name='sex']:checked").val()
    + "&tel=" + $("#tel").val()
    + "&no=" + $("#no").val()
    + "&fav=" + CheckValue()
    + "&Unit=" + $("#unit").val()
    + "&email=" + $("#email").val()
    + "&qq=" + $("#QQ").val()
    + "&fax=" + $("#fax").val()
    + "&Address=" + $("#address").val()
    + "&saleinfo=" + $("#saleinfo").val()
    + "&Remake=" + $("#remake").val()
    + "&typename=" + $("#typename").find("option:selected").text()
    + "&Time=" + new Date();
                $.ajax({
                    type: "get",
                    url: url,
                    cache: false,
                    success: function (Result) {
                        alert("添加成功！");
                        $("#BtnSelete").removeAttr("disabled");
                        $("#name").val("");
                        $("#tel").val("");
                        $("#no").val("");
                        $("#unit").val("");
                        $("#email").val("");
                        $("#QQ").val("");
                        $("#fax").val("");
                        $("#saleinfo").val("");
                        $("#remake").val("");
                        $("#address").val("");
                    },
                    error: function () {
                        alert("操作失败,请重新操作！");
                        $("#BtnSelete").removeAttr("disabled");
                        return;
                    }
                });
            }
        }

        function GetLog() {
            $("#log").html("正在加载数据...");
            $.ajax({
                type: "get",
                url: "CustormsHandler.axd?Name=" + escape($("#name").val()) + "&Tel=" + escape($("#tel").val()), 
                success: function (Reuslt) {
                  
                    var str = "";
                    var arr = new Array();
                    arr = eval(Reuslt); 
                    str += "<table cellpadding=\"1\" cellspacing=\"1\" id=\"TbInfo\" class=\"TbInfo\">";
                    str += "<tr> ";
                    str += "<td class=\"B\">";
                    str += "演出名称";
                    str += "</td> ";
                    str += "<td class=\"B\">";
                    str += "演出类型";
                    str += "</td>";
                    str += "<td class=\"B\">";
                    str += "区域";
                    str += "</td>";
                    str += "<td class=\"B\">";
                    str += "排数";
                    str += "</td>";
                    str += "<td class=\"B\">";
                    str += "座位号";
                    str += "</td>";
                    str += "<td class=\"B\">";
                    str += "购票日期";
                    str += "</td> ";
                    str += "</tr>";

                    $.each(arr, function (i) {
                        str += "<tr>";
                        str += "<td align=\"center\" bgcolor=\"#F6F6F6\">";
                        str += arr[i].Stitle;
                        str += "</td>";
                        str += "<td align=\"center\" bgcolor=\"#F6F6F6\">";
                        str += arr[i].Titlesort;
                        str += "</td>";
                        str += "<td align=\"center\" bgcolor=\"#F6F6F6\">";
                        str += arr[i].Area;
                        str += "</td>";
                        str += "<td align=\"center\" bgcolor=\"#F6F6F6\">";
                        str += arr[i].Row;
                        str += "</td>";
                        str += "<td align=\"center\" bgcolor=\"#F6F6F6\">";
                        str += arr[i].Cow;
                        str += "</td>";
                        str += "<td align=\"center\" bgcolor=\"#F6F6F6\">";
                        str += arr[i].SaleDate;
                        str += "</td>";
                        str += "</tr>";
                    });
                    str += "</table>";
                    $("#log").html(str); 
                },
                error: function (Reuslt) { $("#log").html("数据加载错误。"); },
                cache: false
            });
        }
    </script>
    <style type="text/css">
        .style6
        {
            width: 413px;
        }
        .style7
        {
            height: 19px;
            width: 413px;
        }
        .style8
        {
            height: 12px;
            width: 413px;
        }
        .style9
        {
            height: 35px;
            width: 413px;
        }
        .style10
        {
            height: 14px;
            width: 413px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table align="center" cellpadding="4" cellspacing="1" border="1" width="100%" class="toptable grid fixed">
        <tr>
            <td height="25" class="category t2" style="width: 716px">
                客户资料
            </td>
            <td height="25" class="category">
                <img alt="客户档案库" src="images/right_16x16.gif" /><a href="S_Custorms.aspx">进入客户档案库</a>
            </td>
        </tr>
    </table>
    <table border="1" cellpadding="0" cellspacing="0" bgcolor="#F2F2F2" bordercolor="#f1f7fb"
        style="width: 100%;" align="center">
        <tr>
            <td style="width: 105px;" align="right">
                客户姓名&nbsp;
            </td>
            <td align="left" class="style6">
                <input id="name" class="input" type="text" onchange="GetLog()" />*
            </td>
            <td align="left" rowspan="13" style="vertical-align: top"> 
        
        <div id="log">
        </div> 
        
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px">
                客户职业&nbsp;
            </td>
            <td align="left" class="style6">
                <asp:DropDownList ID="work" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px">
                性别&nbsp;&nbsp;
            </td>
            <td align="left" class="style6">
                <input id="sex1" type="radio" name="sex" value="男" checked="checked" />男
                <input id="sex2" type="radio" name="sex" value="女" />女
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px; height: 19px;">
                客户手机&nbsp;
            </td>
            <td align="left" class="style7">
                <input id="tel" class="input" type="text"  onchange="GetLog()"  />*
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px; height: 19px;">
                客户类型
            </td>
            <td align="left" class="style7">
                <select id="typename" name="D1">
                    <option value="普通客户">普通客户</option>
                    <option value="大客户">大客户</option>
                    <option value="重要客户">重要客户</option>
                </select>
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px; height: 12px">
                &nbsp;身份证号&nbsp;&nbsp;
            </td>
            <td align="left" class="style8">
                <input id="no" class="input" type="text" />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px">
                喜爱的<br />
                演出类型
            </td>
            <td align="left" class="style6">
                <input id="Checkbox2" type="checkbox" value="演唱会" name="cb" />演唱会
                <input id="Checkbox3" type="checkbox" value="话剧" name="cb" />话剧
                <input id="Checkbox4" type="checkbox" value="歌剧" name="cb" />歌剧
                <input id="Checkbox5" type="checkbox" value="音乐会" name="cb" />音乐会
                <input id="Checkbox6" type="checkbox" value="戏曲" name="cb" />戏曲
                <input id="Checkbox7" type="checkbox" value="舞蹈" name="cb" />舞蹈
                <input id="Checkbox8" type="checkbox" value="儿童剧" name="cb" />儿童剧
                 
                <br />
                <input id="Checkbox9" type="checkbox" value="曲艺" name="cb" />曲艺
                <input id="Checkbox10" type="checkbox" value="综艺" name="cb" />综艺
                <input id="Checkbox11" type="checkbox" value="其他" name="cb" />其他
            </td>
        </tr>
        <tr>
            <td style="width: 105px" align="right">
                工作单位&nbsp;
            </td>
            <td align="left" class="style6">
                <input id="unit" class="input" type="text" />
            </td>
        </tr>
        <tr>
            <td style="width: 105px" align="right">
                Email地址&nbsp;
            </td>
            <td align="left" class="style6">
                <input id="email" class="input" type="text" />
            </td>
        </tr>
        <tr>
            <td style="width: 105px; height: 35px" align="right">
                QQ&nbsp;
            </td>
            <td align="left" class="style9">
                <input id="QQ" class="input" type="text" />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px; height: 35px">
                传真&nbsp;
            </td>
            <td align="left" class="style9">
                <input id="fax" class="input" type="text" />
            </td>
        </tr>
        <tr>
            <td style="width: 105px; height: 35px" align="right">
                联系地址&nbsp;
            </td>
            <td align="left" class="style9">
                <input id="address" class="input" type="text" />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 105px">
                购票信息
            </td>
            <td align="left" class="style6">
                <textarea id="saleinfo" cols="20" rows="2" class="textarea"></textarea>
            </td>
        </tr>
        <tr>
            <td style="width: 105px; height: 14px" align="right">
                备注 &nbsp;
            </td>
            <td align="left" class="style10">
                <textarea id="remake" cols="20" rows="2" class="textarea"></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="height: 60px;" align="center">
                <input type="button" id="BtnSelete" value="提交客户资料" onclick="AddCustomer();" onmousemove="showBtnOver(this)"
                    onmouseout="showBtnOut(this)" class="submitMiniGreen" /><br />
                注：如重名可以不用输入'接入电话'，直接填写‘客户手机’即可。
            </td>
            <td align="center" colspan="1" style="height: 60px; width: 500px;">
            </td>
        </tr>
    </table>
</asp:Content>
